/*******************************************************************/
/*
	File: Main.js
*/
/*******************************************************************/
///<reference path='./model/Album.ts'/>

import model = org.ems.example.model;

module org.ems.example
{
    export class Main
    {
        public album:model.Album;

        constructor()
        {
            this.album = new model.Album();
            this.album.id = 1;
            this.album.artist = new model.Artist();
            this.album.artist.name = "Jimi Hendrix";
            this.album.name = "Electric Ladyland";
        }

        public fromJSON(json:string):model.Album
        {
            var data:model.IAlbum = JSON.parse(json);

            return new model.Album(data);
        }

        public toJSON(album:model.Album):string
        {
            return JSON.stringify(album);
        }
    }
}

/*******************************************************************/
